<html>
	<head>
		<title>
			Memory Profiler Test Case
		</title>
		<script>
			var arr = [];
			function addObject() {
				try {
					arr.push('item');
					arr.__len = arr.length;
					delete(arr.__len);
				} catch(ex) {
					alert(ex);
				}
			}

			// NOTE: use setTimeout(0) to wait __observe__ is injected;
			setTimeout(function(){
				try {
					// NOTE: __observe__(getter, setter, attr, handlers);
					// NOTE: now only set and delete is supported, but will add get/add if see necessary;
					// NOTE: use setter to access to target object, because we need replace the original object with wrapped object;
					//       getter isn't necessary since we can hold wrappee and wrapped in observer code;
					// NOTE: handlers {onSet, onDelete};
					// NOTE: onSet(value, new_value, stack);
					// NOTE: onDelete(value, stack);
					// NOTE: if handler is not provided, a default handle will work instead;
					__observe__(function(){
						return window.arr;
					}, function(obj){
						window.arr = obj;
					}, '__len', {onSet: function(){debugger;}, onDelete: function(){debugger;}});
				} catch(ex) {
				}
			}, 0);
		</script>
	</head>
	<body>
		<input type="button" value="Add an Object" onclick="javascript:addObject();"/>
		<div id="output">
		</div>
	</body>
</html>
